<template>
  <div class="mui-numbox" data-numbox-min="1" :data-numbox-max="max">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" type="number" value="1" />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from "../../../lib/mui/js/mui.js";
export default {
  data() {
    return {};
  },
  methods: {},
  mounted() {
    //组件挂载到页面中初始化数字框
    mui(".mui-numbox").numbox();
  },
  props: ["max"],
  watch: {
    //监听max,起初max是通过ajax获取的，在组件渲染完成之后获得
    //所以要监听max变化重新赋值
    max(newval) {
      mui(".mui-numbox").numbox().setOption("max", newval);
    },
  },
};
</script>

<style  lang="scss" scoped>
</style>